/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  config.security = {
　　　　csrf: {
　　　　　　enable: false
　　　　},
　　　　domainWhiteList: [ '*' ]
　　};
   config.cors = {
     origin: '*',
     allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS'
   };

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1576548729368_4995';

  // add your middleware config here
  config.middleware = [];

  // 模板引擎配置
  config.view = {
    mapping: {
      '.html': 'ejs',
    },
  };
  config.mysql = {
      client: {
          host: 'localhost',
          port: '3306',
          user: 'tdy',
          password: '666666',
          // 数据库名
          database: 'egg_article',
      },
      // 是否加载到 app 上，默认开启
      app: true,
      // 是否加载到 agent 上，默认关闭
      agent: false,
  };
  // log输出，正式环境关掉
  config.logger = {
    disableConsoleAfterReady: true,
  };
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
